import { _decorator, Collider2D, Component, Node } from 'cc';
import { Player } from './Player';
import { PlayerState } from './PlayerState';
import { PlayerStateMachine } from './PlayerStateMachine';
const { ccclass, property } = _decorator;

@ccclass('PlayerDeathState')
export class PlayerDeathState extends PlayerState {
    constructor(_player: Player, _stateMachine: PlayerStateMachine) {
        super(_player, _stateMachine);
    }

    override enter(): void {
        super.enter();
        this.player.SetVelocity(0, 0);
        setTimeout(() => {
            if (this.player.node && this.player.node.isValid) {
                this.player.node.destroy();
            }
        }, 50);
        this.player.gameOverWnd.active = true;
    }

    override update(dt: number): void {
        super.update(dt);


    }

    override exit(): void {
        super.exit();

    }
}


